package model

import "github.com/zeromicro/go-zero/core/stores/sqlx"

var _ FoodModel = (*customFoodModel)(nil)

type (
	// FoodModel is an interface to be customized, add more methods here,
	// and implement the added methods in customFoodModel.
	FoodModel interface {
		foodModel
		withSession(session sqlx.Session) FoodModel
	}

	customFoodModel struct {
		*defaultFoodModel
	}
)

// NewFoodModel returns a model for the database table.
func NewFoodModel(conn sqlx.SqlConn) FoodModel {
	return &customFoodModel{
		defaultFoodModel: newFoodModel(conn),
	}
}

func (m *customFoodModel) withSession(session sqlx.Session) FoodModel {
	return NewFoodModel(sqlx.NewSqlConnFromSession(session))
}
